package com.sf.web.controller;

import com.sf.service.IAmountService;
import com.sf.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;

@Controller
public class AmountController {

    @Autowired
    private IAmountService amountService;

    @RequestMapping("/trans")
    @ResponseBody
    public JsonResult trans(Long toId, Long fromId, BigDecimal amount){
        try{
            amountService.trans(toId,fromId,amount);
            return new JsonResult(true,"转账成功",null);
        }catch (Exception e){
            e.printStackTrace();
            return new JsonResult(false,"转账失败",null);
        }



    }
}
